﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Runtime.Serialization;
using System.Collections;

namespace SchemaMonitor.json
{
    [DataContract]
    public class CFieldBlob : CField
    {
        //Members
        [DataMember(Order = 1)]
        public List<byte[]> Blob;

        //Constructor
        public CFieldBlob(CNodeBasic parent, CTag tag, object value) : base(parent, tag)
        {
            this.Value = value;
        }
        //Serialisation Constructors
        private CFieldBlob() { }
        static CFieldBlob() { ProtoBuf.Serializer.PrepareSerializer<CFieldBlob>(); }

        //Must Override
        public    override IList List       {  get { return Blob; }     set {  Blob = value.Cast<byte[]>().ToList(); } }
        protected override IList InitList()               { return new List<byte[]>(); }
        protected override IList InitList(object[] array) { return array.Cast<byte[]>().ToList(); }
    }
}
